fix(message): render messages/_message partial in broadcasts#143
Merged
fix(message): render messages/_message partial in broadcasts#143
Conversation
RubyLLM 1.14.1 added a `to_partial_path` override returning "messages/<role>" (user/assistant/system/tool). With the bump from 1.11.0 in #102, turbo-rails' `broadcasts_to` stopped finding a partial because the app only has a single role-aware `_message.html.erb`. Every message save crashed Turbo::Streams::ActionBroadcastJob with ActionView::MissingTemplate, silently breaking live chat UI updates for subscribers (real chats, summaries, testimonials, translations). Pin the broadcast partial explicitly. Added a regression test that saves a Message with every role and asserts the enqueued broadcast job renders cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9d613e5 to
ad0b6e1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ActionView::MissingTemplate: Missing partial messages/_usererror that started after theruby_llmbump from 1.11.0 → 1.14.1 in Bump anthropic from 1.6.0 to 1.10.0 #102.broadcasts_topartial tomessages/messageso turbo-rails stops falling back to RubyLLM's role-basedto_partial_path.Root cause
ruby_llm1.14.1 introduced ato_partial_pathoverride inRubyLLM::ActiveRecord::MessageMethodsthat returns"messages/<role>"(user/assistant/system/tool). The app'sMessage#broadcasts_tohad no explicitpartial:, so turbo-rails usedto_partial_pathand looked up non-existent partials likemessages/_user.html.erb. The app has a single role-aware_message.html.erb.Every message save — real chats and system chats (summaries, testimonials, translations) — crashed
Turbo::Streams::ActionBroadcastJob. The underlying saves succeeded, but Turbo Stream subscribers never received updates, silently breaking live chat UI refresh for real users.Test plan
MessageTest#test_broadcasts_create_using_messages/message_partial_regardless_of_role— saves a Message with each role (user/assistant/system/tool) and asserts the enqueued broadcast job renders without raising. Confirmed it reproduces the production error against the unfixed code.rails test test/models/— all 191 tests pass.rubocopclean.brakemanclean.🤖 Generated with Claude Code